<?php if (!defined('THINK_PATH')) exit();?>﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link href="/thinkphp/Public/bootstrap2.3.2/css/bootstrap.min.css" rel="stylesheet" />
    <title></title>
    <link href="/thinkphp/Public/css/Common.css" rel="stylesheet" />
    <link href="/thinkphp/Public/css/Index2.css" rel="stylesheet" />
    <script type="text/javascript" charset="utf-8" src="/thinkphp/Public/editor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="/thinkphp/Public/editor/ueditor.all.min.js"> </script>
       <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
       <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
    <script type="text/javascript" charset="utf-8" src="/thinkphp/Public/editor/lang/zh-cn/zh-cn.js"></script>
</head>
<body>
<div class="container-fluid">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3 id="myModalLabel">添加自定义菜单</h3>
    </div>
    <div class="modal-body">
        <form class="form-horizontal" method="post">
            <div class="control-group">
                <label class="control-label">菜单名称</label>
                <div class="controls">
                    <input type="text" name="name" placeholder="菜单名称" value="<?php echo ($data["name"]); ?>">
                </div>
            </div>
            <div class="control-group">
                <label class="control-label">上级菜单</label>
                <div class="controls">
                    <select name="pid">
                        <option value="0" <?php if(($data["pid"]) == "0"): ?>selected<?php endif; ?>>一级菜单</option>
                        <?php if(is_array($menu)): $i = 0; $__LIST__ = $menu;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><option value="<?php echo ($vo["id"]); ?>" <?php if($vo['id'] == $data['pid']){echo 'selected';}?>><?php echo ($vo["name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                    </select>
                </div>
            </div>
            <div class="control-group">
                <label class="control-label">类型</label>
                <div class="controls">
                    <input type="radio" name='type' value="1" <?php if(($data["type"]) == "1"): ?>checked<?php endif; ?>/>关键字　
                    <input type="radio" name='type' value="2" <?php if(($data["type"]) == "2"): ?>checked<?php endif; ?>/>跳转
                </div>
            </div>
            <div class="control-group">
                <label class="control-label">跳转地址/关键字</label>
                <div class="controls">
                    <input id="key" type="text" placeholder="跳转地址/关键字" value='<?php if(empty($data["key"])): echo ($data["url"]); else: echo ($data["key"]); endif; ?>'>
                </div>
            </div>
            <input type="hidden" name="id" value="<?php echo ($data["id"]); ?>">
        </form>
    </div>
    <div class="modal-footer">
        <button class="btn" onclick='history.go(-1)'>返回</button>
        <button class="btn btn-primary" id="add" onclick="add();">保存</button>
    </div>
</div>
	<script src="/thinkphp/Public/js/jquery-1.9.1.min.js"></script>
    <script src="/thinkphp/Public/bootstrap2.3.2/js/bootstrap.min.js"></script>
    <script src="/thinkphp/Public/layer-v2.3/layer/layer.js"></script>
    <script src="/thinkphp/Public/js/Index2.js"></script>
</body>
</html>
<script>
    $("input[type='radio']").click(function(){
        if($(this).val() == 1){
            $('#key').attr('name','key');
        }else{
            $('#key').attr('name','url');
        }
    });
    $('input:checked').click();
</script>